#include "qvarpropertyeditor.h"
#include "property/qabstractproperty.h"

QVarPropertyEditor::QVarPropertyEditor(QAbstractProperty *property, QUndoStack *unStack, QWidget *parent):
    QCommonEditor(property,unStack,parent)
{
    m_property = property;
}


void QVarPropertyEditor::onPropertyChanged()
{
    qDebug() << "QVarPropertyEditor::onPropertyChanged:property->" << m_property ;
    if(m_property) {
        qDebug() << "QVarPropertyEditor::onPropertyChanged:property value->" << m_property->getValueText() ;
        m_text->setText(m_property->getValueText());
        if(m_property->getValueIcon().isNull()) {
            m_icon->setVisible(false);
        } else {
            QPixmap pix = m_property->getValueIcon().pixmap(QSize(16, 16));
            m_icon->setFixedSize(16, 16);
            m_icon->setPixmap(pix);
        }
    }
}

void QVarPropertyEditor::onValueChanged()
{
    qDebug() << "QVarPropertyEditor::onValueChanged:property->" << m_property ;

}
